<template>
	<view class="container">
	</view>
</template>

<script>
	import {
		dateUtils,
		authTokenUtil,
		validLoginToken
	} from "../../common/util.js"
	export default {
		data() {
			return {
				
			}
		},
		methods: {
		init: function () {
				let _this = this;
				console.log('init');
				_this.datas.StartQiangGou = false;
				if (_this.Timer) {
					clearInterval(_this.Timer);
				}
				
				//测试代码开始
					_this.datas.StartQiangGou = true;
				return ;
				//测试代码结束
				
				//正式代码
				_this.Timer = setInterval(() => {
					let curTime = new Date();
					let nextQiangGouTime = _this.getNextQiangGouTime();
					let current = new Date(curTime);
					let specified = new Date(nextQiangGouTime);
		
					// 计算时间戳差值（毫秒）
					let diff = specified - current;
					if (diff <= 0) {
						_this.datas.StartQiangGou = true;
						clearInterval(_this.Timer);
						return;
					}
					_this.datas.TimeRemaining = _this.formatTimeRemaining(curTime, nextQiangGouTime);
				}, 1000);
			}
		},
		onShow(){
			let _this = this;
			// _this.init();
		},
		created() {
			let _this = this;
			validLoginToken(null, () => {
				uni.reLaunch({
					url: "/pages/account/login"
				})
			})
			_this.init();
		}
	}
</script>

<style>


	.container {
		display: flex;
		flex-direction: column;
		justify-content: flex-start;
		align-items: stretch;
	}

	
</style>
